package com.ttj.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ttj.domain.oracle.SysconfBranch;
import com.ttj.mapper.oracle.SysconfBranchMapper;
import com.ttj.service.BranchService;
import com.ttj.vo.BaseRes;
@Service
public class BranchServiceImpl implements BranchService {

	@Resource
	private SysconfBranchMapper branchMapper;
	
	@Override
	public BaseRes<List<SysconfBranch>> getDistrict(String username) {
		Map<String,Object> map = new HashMap<String, Object>();
		map.put("username", username);
		List<SysconfBranch> branchList = branchMapper.getDistrict(username);
		BaseRes<List<SysconfBranch>> baseRes = new BaseRes<List<SysconfBranch>>();
		baseRes.setData(branchList);
		return baseRes;
	}

	@Override
	public BaseRes<List<SysconfBranch>> getArea(String username, String district) {
		Map<String,Object> map = new HashMap<String, Object>();
		map.put("username", username);
		map.put("district", district);
		List<SysconfBranch> branchList = branchMapper.getArea(map);
		BaseRes<List<SysconfBranch>> baseRes = new BaseRes<List<SysconfBranch>>();
		baseRes.setData(branchList);
		return baseRes;
	}

	@Override
	public BaseRes<List<SysconfBranch>> getStreet(String username, String area) {
		Map<String,Object> map = new HashMap<String, Object>();
		map.put("username", username);
		map.put("area", area);
		List<SysconfBranch> branchList = branchMapper.getStreet(map);
		BaseRes<List<SysconfBranch>> baseRes = new BaseRes<List<SysconfBranch>>();
		baseRes.setData(branchList);
		return baseRes;
	}

	@Override
	public BaseRes<List<SysconfBranch>> getCommunity(String username,String street) {
		Map<String,Object> map = new HashMap<String, Object>();
		map.put("username", username);
		map.put("street", street);
		List<SysconfBranch> branchList = branchMapper.getCommunity(map);
		BaseRes<List<SysconfBranch>> baseRes = new BaseRes<List<SysconfBranch>>();
		baseRes.setData(branchList);
		return baseRes;
	}

}
